package com.myspring.controller;

import com.myspring.entity.Article;
import com.myspring.service.MyService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;

import java.util.Date;

@Controller
@RequestMapping(value ={"/mycontroller7"} )
public class MyController7 {
    @Autowired
    private MyService myService;

    @RequestMapping(value = "/mymethod7/{uid}/{edittime}/{mdcontent}/{title}")
    public ResponseEntity<Boolean> mymethod7(@PathVariable(value = "uid") Integer uid,
                                             @PathVariable(value = "edittime" ) Date edittime,
                                             @PathVariable(value = "mdcontent") String mdcontent,
                                             @PathVariable(value = "title") String title ) throws Exception {
        this.myService.addArticle(uid,edittime,mdcontent,title);
        return new ResponseEntity<Boolean>(true, HttpStatus.OK);
    }
}
